package com.moana.buyTicket.util;

import javax.servlet.http.HttpSession;

import com.moana.buyTicket.entity.Person;


public class SessionUtils 
{
	//管理员
	public static Integer getManagerId(HttpSession session)
	{
		Person person = (Person)session.getAttribute(SessionKeys.MANAGER);
		if(person!=null)
		{
			return person.getId();
		}
		else
		{
			return null;
		}
	}

	public static String getManagerName(HttpSession session)
	{
		Person person = (Person)session.getAttribute(SessionKeys.MANAGER);
		if(person!=null)
		{
			return person.getName();
		}
		else
		{
			return null;
		}
	}

	//操作员
	public static Integer getOperatorId(HttpSession session)
	{
		Person person = (Person)session.getAttribute(SessionKeys.OPRATOR);
		if(person!=null)
		{
			return person.getId();
		}
		else
		{
			return null;
		}
	}

	public static String getOperatorName(HttpSession session)
	{
		Person person = (Person)session.getAttribute(SessionKeys.OPRATOR);
		if(person!=null)
		{
			return person.getName();
		}
		else
		{
			return null;
		}
	}
	
	//游客
	public static Integer getViewerId(HttpSession session)
	{
		Person person = (Person)session.getAttribute(SessionKeys.VIEWER);
		if(person!=null)
		{
			return person.getId();
		}
		else
		{
			return null;
		}
	}

	public static String getViewerName(HttpSession session)
	{
		Person person = (Person)session.getAttribute(SessionKeys.VIEWER);
		if(person!=null)
		{
			return person.getName();
		}
		else
		{
			return null;
		}
	}
}
